Skip to content

fix: cabal sdist target selection (#11385) - #12440

Open
blackheaven wants to merge 2 commits into
haskell:masterfrom
blackheaven:fix/sdist-selector
Open

blackheaven wants to merge 2 commits into
haskell:masterfrom
blackheaven:fix/sdist-selector

Conversation

@blackheaven

Copy link
Copy Markdown
Collaborator

Please read Github PR Conventions and then fill in one of these two templates.


Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

QA Notes

Fresh cabal init project, from prova: sdist prova wrote tarball sdist to /prova-0.1.0.0.tar.gz; sdist prova:lib:prova succeeds too;

@blackheaven
blackheaven requested review from phadej and a balanced review from Copilot October 10, 2026 14:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Multiple selectors resolving to one package cause duplicate archive generation and incorrect stdout rejection.

1 open finding
What changed in this PR

Fixes cabal sdist so local component selectors package their containing package.

Changes:

  • Reinterprets local component targets as package targets.
  • Adds regression coverage for subdirectory and multi-target selection.
  • Documents the behavior change.
File Description
changelog.d/​11385.md Documents corrected target selection.
cabal-install/​src/​Distribution/​Client/​CmdSdist.hs Maps component selectors to packages.
cabal-testsuite/​PackageTests/​NewSdist/​SubDirPackageTarget/​subdir-target.test.hs Tests package selection from a subdirectory.
cabal-testsuite/​PackageTests/​NewSdist/​SubDirPackageTarget/​subdir-target.out Records expected command output.
cabal-testsuite/​PackageTests/​NewSdist/​SubDirPackageTarget/​p/​P.hs Provides the fixture module.
cabal-testsuite/​PackageTests/​NewSdist/​SubDirPackageTarget/​p/​p.cabal Defines the fixture package.
cabal-testsuite/​PackageTests/​NewSdist/​SubDirPackageTarget/​cabal.project Configures the fixture project.
cabal-testsuite/​PackageTests/​NewSdist/​MultiTarget/​valid-and-test-suite.test.hs Tests mixed package/component targets.
cabal-testsuite/​PackageTests/​NewSdist/​MultiTarget/​valid-and-test-suite.out Records multi-target output.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cabal-install/src/Distribution/Client/CmdSdist.hs
Multiple target selectors matching the same package (e.g. 'cabal sdist
a a-tests') generated duplicate archives and made the stdout output
guard reject a single tarball with [Cabal-7152]. Deduplicate the
packages produced by reifyTargetSelectors by packageId. Addresses the
Copilot review on haskell#12440.
@zlonast zlonast linked an issue Oct 11, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cabal sdist target selection is broken

2 participants